package com.neusoft.data.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.neusoft.data.mapper.SerChatHistoryMapper;
import com.neusoft.data.domain.SerChatHistory;
import com.neusoft.data.service.ISerChatHistoryService;

/**
 * 聊天记录Service业务层处理
 * 
 * @author slh
 * @date 2024-03-14
 */
@Service
public class SerChatHistoryServiceImpl implements ISerChatHistoryService 
{
    @Autowired
    private SerChatHistoryMapper serChatHistoryMapper;

    /**
     * 查询聊天记录
     * 
     * @param chatId 聊天记录主键
     * @return 聊天记录
     */
    @Override
    public SerChatHistory selectSerChatHistoryByChatId(Long chatId)
    {
        return serChatHistoryMapper.selectSerChatHistoryByChatId(chatId);
    }

    /**
     * 查询聊天记录列表
     * 
     * @param serChatHistory 聊天记录
     * @return 聊天记录
     */
    @Override
    public List<SerChatHistory> selectSerChatHistoryList(SerChatHistory serChatHistory)
    {
        return serChatHistoryMapper.selectSerChatHistoryList(serChatHistory);
    }

    /**
     * 新增聊天记录
     * 
     * @param serChatHistory 聊天记录
     * @return 结果
     */
    @Override
    public int insertSerChatHistory(SerChatHistory serChatHistory)
    {
        serChatHistory.setCreateTime(DateUtils.getNowDate());
        return serChatHistoryMapper.insertSerChatHistory(serChatHistory);
    }

    /**
     * 修改聊天记录
     * 
     * @param serChatHistory 聊天记录
     * @return 结果
     */
    @Override
    public int updateSerChatHistory(SerChatHistory serChatHistory)
    {
        serChatHistory.setUpdateTime(DateUtils.getNowDate());
        return serChatHistoryMapper.updateSerChatHistory(serChatHistory);
    }

    /**
     * 批量删除聊天记录
     * 
     * @param chatIds 需要删除的聊天记录主键
     * @return 结果
     */
    @Override
    public int deleteSerChatHistoryByChatIds(Long[] chatIds)
    {
        return serChatHistoryMapper.deleteSerChatHistoryByChatIds(chatIds);
    }

    /**
     * 删除聊天记录信息
     * 
     * @param chatId 聊天记录主键
     * @return 结果
     */
    @Override
    public int deleteSerChatHistoryByChatId(Long chatId)
    {
        return serChatHistoryMapper.deleteSerChatHistoryByChatId(chatId);
    }
}
